﻿using ConfExpert.Forms.Base;
using DevTeam;
using System;
using System.Data;

namespace ConfExpert.Forms.Depo
{
    public partial class OncekiPartiyeEkle : XForm
    {
        public OncekiPartiyeEkle()
        {
            InitializeComponent();
        }

        private void OncekiPartiyeEkle_Load(object sender, EventArgs e)
        {
            
            gridView1.Init("GetOncekiGPler");
            gridView1.FormatAsDate("BelgeTarihi");
            gridView1.FormatAsNumber(1, "TotalQty");
            gridView1.MakeReadOnly();
            gridView1.MakeRowSelectable();
            gridView1.AddSummary();
            gridView1.BestFitColumns();

            bbiEkle.ItemClick += bbiEkle_ItemClick;
            gridView1.DoubleClick += gridView1_DoubleClick;
        }

        void gridView1_DoubleClick(object sender, EventArgs e)
        {
            Ekle();
        }

        void bbiEkle_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            Ekle();
        }

        public DataRow dr;
        void Ekle()
        {
            gridView1.EndEditing();
            dr = gridView1.GetDataRow(gridView1.FocusedRowHandle);
            if (dr!=null)
                this.DialogResult = System.Windows.Forms.DialogResult.OK;
        }
    }
}
